/*
 * @Author: error: git config user.name && git config user.email & please set dead value or install git
 * @Date: 2022-10-15 20:55:58
 * @LastEditors: error: git config user.name && git config user.email & please set dead value or install git
 * @LastEditTime: 2022-10-16 17:45:03
 * @FilePath: \01我的\界面项目1\main.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

"ui";
let ViewIdListRegisterListener = require("/sdcard/脚本/星临_每天赚点/ViewIdListRegisterListener");
let viewHeight = "150px";
let textSize = "20sp";
ui.layout(
  <vertical margin="20">
    <text textSize="25sp" textStyle="bold" gravity="center" textColor="#008000">
      {" "}
    星临项目配置
    </text>
    <vertical>
        <horizontal>
          <text text="请输入激活卡:"  textStyle="bold" textSize="18sp" color="#008000"/>
          <input id="jhm" text="0" color="#666666" w="*"/>
      </horizontal>
      </vertical>
    <button id="btn" textStyle="bold" textSize="20" text="任 务 类 型 配 置" color="#ffffff" bg="#008000" foreground="?selectableItemBackground" layout_gravity="bottom"></button>
    <vertical weightSum="5" padding="18 8" marginBottom="2" h="auto">
      <checkbox id="xhs_gz" text="小红书关注"  textSize="18sp" textStyle="bold" color="#005AFF" checked="true"></checkbox>
      <checkbox id="bl_gz" text="哔哩关注"  textSize="18sp" textStyle="bold" color="#005AFF" checked="true"></checkbox>
      <checkbox id="bl_dz" text="哔哩点赞"  textSize="18sp" textStyle="bold" color="#005AFF" checked="true"></checkbox>
      <checkbox id="bl_sl" text="哔哩三连"  textSize="18sp" textStyle="bold" color="#005AFF"></checkbox>
      <button id="btn1" textStyle="bold" textSize="20" text="任 务 时 长 配 置" color="#ffffff" bg="#008000" foreground="?selectableItemBackground" layout_gravity="bottom"></button>
      <horizontal>
          <text text="纯刷任务时长:"  textSize="18sp" textStyle="bold" color="#005AFF"/>
          <input id="pzrwsc" text="0" color="#FF0000" w="*"/>
      </horizontal>
      <horizontal>
          <text text="养 号 时 长:"  textSize="18sp" textStyle="bold" color="#005AFF"/>
          <input id="pzyhsc" text="10" color="#FF0000" w="*"/>
      </horizontal>
      <text text="总时长=纯刷任务时长+养号时长*4。养号时长为刷任务前、后每个APP浏览时长"  textStyle="bold" textSize="15sp"/>
    </vertical>
    <button id="qd"  w="auto" textStyle="bold" textSize="20" text="  保存配置并启动  " color="#ffffff" bg="#008000" foreground="?selectableItemBackground" layout_gravity="center"></button>
    <horizontal>
    <text text="作者：星临" marginTop="20" textStyle="bold" textSize="18sp" color="#008000"/>  
    </horizontal>
    <horizontal>
      <text text="点击复制微信号，交流项目: " textStyle="bold" color="#008000" textSize="18sp" h="*" w="0dp" gravity="center_vertical" layout_weight="10"></text>
      <button
        id="qq"
        text="woo2077"
        textSize="18"
        textStyle="bold"
        h="*"
        w="0dp"
        layout_weight="4"
        bg="#00A000"
        style="Widget.AppCompat.Button.Colored"
      ></button>
    </horizontal>
    <text text="目录中的main.js用于配置并启动，每天主程序.js可用于执行定时任务，配置不变的话，直接运行主程序。"  color="#008000" textStyle="bold" textSize="16sp"/>
  </vertical>
);

ui.qd.click(() => {
  threads.start(zhujinc);
});

ui.qq.click(() => {
  setClip(ui.qq.text());
  toastLog("已复制微信号，请到添加作者微信");
  toastLog(ViewIdListRegisterListener);
});



let storage = storages.create("UIConfigInfo");
let 需要备份和还原的控件id列表集合 = [
  ["jhm","pzrwsc","pzyhsc"],
  ["xhs_gz", "bl_gz", "bl_dz", "bl_sl"],
];

需要备份和还原的控件id列表集合.map((viewIdList) => {
  let inputViewIdListRegisterListener = new ViewIdListRegisterListener(viewIdList, storage, ui, true);
  inputViewIdListRegisterListener.registerlistener();
  inputViewIdListRegisterListener.restore();
});

storages.remove("xinglinmeitian01");
let xmpz = storages.create("xinglinmeitian01");

function bcpz(){
  var jhm = ViewIdListRegisterListener.prototype.getState("jhm", ui);
  var pzyhsc = ViewIdListRegisterListener.prototype.getState("pzyhsc", ui);
  var pzrwsc = ViewIdListRegisterListener.prototype.getState("pzrwsc", ui);

  var xhs_gz = ViewIdListRegisterListener.prototype.getState("xhs_gz", ui);
  var bl_dz = ViewIdListRegisterListener.prototype.getState("bl_dz", ui);
  var bl_gz = ViewIdListRegisterListener.prototype.getState("bl_gz", ui);
  var bl_sl = ViewIdListRegisterListener.prototype.getState("bl_sl", ui);
  //输入框
  xmpz.put("jhm",jhm);
  xmpz.put("pzyhsc",pzyhsc);
  xmpz.put("pzrwsc",pzrwsc);
  xmpz.put("xhs_gz",xhs_gz);
  xmpz.put("bl_dz",bl_dz);
  xmpz.put("bl_gz",bl_gz);
  xmpz.put("bl_sl",bl_sl);
}

function zhujinc(){
  toastLog('已启动运行，验证中...');
  bcpz();
  engines.execScriptFile('/sdcard/脚本/星临_每天赚点/每天主程序.js')
};
var t=1;

